//
//  WCExtractUrl_gui.m
//  WebClipper
//
//  Created by Daniel Braun on 31/03/07.
//  Copyright 2007Daniel Braun http://page-appart.net, http://braun.daniel.free.fr  All rights reserved.
//

#import "WCExtractUrl.h"
#import "WCExtractUrl_gui.h"
#import "WCWebFetchController.h"
#import "WCWebExtractSet.h"
#import "MyDocument.h"


@implementation WCExtractUrl_gui

- (IBAction) followUrl:(id) sender
{
	NSLog(@"follow url %@\n", [(WCExtractUrl *)parentObject url]);
	WCWebFetchController *c=(WCWebFetchController *) controller;
	NSURL *s=[(WCExtractUrl *)parentObject stringUrl];
	if (!s) return;
	NSURL *nurl=[NSURL URLWithString:s relativeToURL:[NSURL URLWithString:[c surl]]] ;
	nurl=[NSURL URLWithString:[nurl absoluteString]];
	//[c setRelativeUrl:[(WCExtractUrl *)parentObject url]];
	//xxxx
	WCWebExtractSet *ne=[[WCWebExtractSet alloc]init];
	//[ne setActualUrl:nurl];
	nurl=[NSURL URLWithString:@"webextract://prevurl"];
	[ne setOfficialUrl:nurl];
	MyDocument *cd=[[NSDocumentController sharedDocumentController]currentDocument];
	[cd addExtractionSet:ne];
	[ne release];
	[c setEditingMode:0];
	return;
	

}
@end
